package cn.semcorp.zhuhaizj.quartzJob;

import cn.semcorp.zhuhaizj.repo.IRedisRepository;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;


@Slf4j
public class TobeRedisJob implements Job {

    @Autowired
    private IRedisRepository template;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        tobeExpireRedis();
    }


    /**
     * 监控
     */
    public void tobeExpireRedis(){
        log.info("定时任务:开始清除Redis中人员架构缓存数据...");
        template.deleteSchema();
        log.info("定时任务:清除Redis中人员架构缓存数据成功!");

        log.info("定时任务:开始清除Redis中人员职位缓存数据...");
        template.deleteFlower();
        log.info("定时任务:清除Redis中人员职位缓存数据成功!");

        log.info("定时任务:开始清除Redis中人员信息缓存数据...");
        template.deleteFlowerList();
        log.info("定时任务:清除Redis中人员信息缓存数据成功!");

        log.info("定时任务:开始清除Redis中学习计划总览缓存数据...");
        template.deleteCountStudy();
        log.info("定时任务:清除Redis中学习计划总览缓存数据成功!");
    }

}
